package com.hspedu.String;

/**
 * @Author Stringzhua
 * @Date 2024/3/8 20:32
 * description:
 * String的equals方法进行了@Override
 *
 *   public boolean equals(Object anObject) {
 *         if (this == anObject) {
 *             return true;
 *         }
 *         if (anObject instanceof String) {
 *             String anotherString = (String)anObject;
 *             int n = value.length;
 *             if (n == anotherString.value.length) {
 *                 char v1[] = value;
 *                 char v2[] = anotherString.value;
 *                 int i = 0;
 *                 while (n-- != 0) {
 *                     if (v1[i] != v2[i])
 *                         return false;
 *                     i++;
 *                 }
 *                 return true;
 *             }
 *         }
 *         return false;
 *     }
 */
public class StringExercise01 {
    public static void main(String[] args) {
        String a = "abc";
        String b = "abc";
        System.out.println(a.equals(b));//T
        System.out.println(a == b);//T
    }
}
